<?php
class Game {

	var $id, $player1Id, $player2Id, $winnerId, $race1, $race2, $finished, $startDate, $finishDate;

	public function Game() {
		if (DEBUG) enex("Game::Game()");
	}

	/**
	*  @param gameString Game object serialized to String
	* */
	public function buildFromString($gameString) {
		if (DEBUG) enter("Game::buildFromString($gameString)");
		list($this->id, $this->player1Id, $this->player2Id, $this->winnerId, $this->race1, $this->race2,
			 $this->finished, $this->startDate, $this->finishDate) = split(" ", $gameString);
		if (DEBUG) ex("Game::buildFromString()");
		return $this;
	}

	public function buildFromValue($id, $player1Id, $player2Id, $winnerId, $race1, $race2, $finished, $startDate, $finishDate) {
		if (DEBUG) enter("Game::buildFromValue($id, $player1Id, $player2Id, $winnerId, $race1, $race2, $finished, $startDate, $finishDate)");
		$this->id = $id;
		$this->player1Id = $player1Id;
		$this->player2Id = $player2Id;
		$this->winnerId = $winnerId;
		$this->race1 = $race1;
		$this->race2 = $race2;
		$this->finished = $finished;
		$this->startDate = $startDate;
		$this->finishDate = $finishDate;
		if (DEBUG) ex("Game::buildFromValue($id, $player1Id, $player2Id, $winnerId, $race1, $race2, $finished, $startDate, $finishDate)");
	}

	public function toString() {
		if (DEBUG) enex("Game::toString()");
		return "$this->id $this->player1Id $this->player2Id $this->winnerId $this->race1 $this->race2 $this->finished $this->startDate $this->finishDate";
	}

	public function getId() {
		if (DEBUG) enex("Game::getId()");
		return $this->id;
	}

	public function getPlayer1Id() {
		if (DEBUG) enex("Game::getPlayer1Id()");
		return $this->player1Id;
	}

	public function getPlayer2Id() {
		if (DEBUG) enex("Game::getPlayer2Id");
		return $this->player2Id;
	}

	public function getWinnerId() {
		if (DEBUG) enex("Game::getWinnerId()");
		return $this->winnerId;
	}

	public function getRace1() {
		if (DEBUG) enex("Game::getRace1");
		return $this->race1;
	}

	public function getRace2() {
		if (DEBUG) enex("Game::getRace2");
		return $this->race2;
	}

	public function getFinished() {
		if (DEBUG) enex("Game::getFinished");
		return $this->finished;
	}

	public function getStartDate() {
		if (DEBUG) enex("Game::getStartDate");
		return $this->startDate;
	}

	public function getFinishDate() {
		if (DEBUG) enex("Game::getFinishDate");
		return $this->finishDate;
	}

	public function setId($newId) {
		if (DEBUG) enex("Game::setId()");
		$this->id = $newId;
	}

	public function setPlayer1Id($newPlayer1Id) {
		if (DEBUG) enex("Game::setPlayer1Id()");
		$this->player1Id = $newPlayer1Id;
	}

	public function setPlayer2Id($newPlayer2Id) {
		if (DEBUG) enex("Game::setPlayer2Id");
		$this->player2Id = $newPlayer2Id;
	}

	public function setWinnerId($newWinnerId) {
		if (DEBUG) enex("Game::setWinnerId()");
		$this->winnerId = $newWinnerId;
	}

	public function setRace1($newRace1) {
		if (DEBUG) enex("Game::setRace1");
		$this->race1 = $newRace1;
	}

	public function setRace2($newRace2) {
		if (DEBUG) enex("Game::setRace2");
		$this->race2 = $newRace2;
	}

	public function setFinished($newFinished) {
		if (DEBUG) enex("Game::setFinished");
		$this->finished = $newFinished;
	}

	public function setStartDate($newStartDate) {
		if (DEBUG) enex("Game::setStartDate");
		$this->startDate = $newStartDate;
	}

	public function setFinishDate($newFinishedDate) {
		if (DEBUG) enex("Game::setFinishDate");
		$this->finishDate = $newFinishedDate;
	}

}
?>